package org.jeecg.modules.manage.mapper;

import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.manage.entity.CaishuiBusinessBank;
import org.jeecg.modules.manage.entity.CaishuiRecharge;

import java.util.List;
import java.util.Map;

/**
 * @Description: 账户充值
 * @Author: yfkj
 * @Date:   2023-02-22
 * @Version: V1.0
 */
@InterceptorIgnore(tenantLine = "true")
public interface MCaishuiRechargeMapper extends BaseMapper<CaishuiRecharge> {

    /**
     * 查询充值总额
     * @param params
     * @return
     */
    public Map<String,Object> queryTotalAmount(@Param("params") Map<String, String> params);

    /**
     * 最近7天充值统计
     * @return
     */
    public List<Map<String,Object>> last7DaysRechargeStatistics(@Param("params") Map<String, String> params);

    /**
     * 最近30天充值统计
     * @return
     */
    public List<Map<String,Object>> last30DaysRechargeStatistics(@Param("params") Map<String, String> params);

    /**
     * 最近一年充值统计
     * @return
     */
    public List<Map<String,Object>> lastOneYearRechargeStatistics(@Param("params") Map<String, String> params);


    /**
     * 通过账号和记账子单元查询银行商户信息
     * @return
     */
    @Select("SELECT * FROM caishui_business_bank WHERE type = 1 AND main_account = #{mainAccount} AND sub_account_id = #{subAccountId}")
    public CaishuiBusinessBank queryBusinessBank(@Param("mainAccount") String mainAccount, @Param("subAccountId") String subAccountId);


}
